//  this library.
/// 资料相关模型
class ResourceModel {
  String? createdTime;
  String? modifyTime;
  String? createdBy;
  String? modifyBy;
  String? id;

  // 考试id
  String? examId;

  // 考试名
  String? examName;

  // 行业id
  String? industryId;

  // 行业名
  String? industryName;

  // 科目Id
  int? categoryId;

  // 科目名称
  String? categoryName;

  // 标题
  String? title;

  // 别名
  String? alias;

  // 排序
  int? sort;

  // 是否置顶
  bool? top;

  // 是否热门
  bool? hot;

  // 类型，0.考试资讯，1.考试资料
  bool? type;

  // 封面
  String? cover;

  // 摘要
  String? summary;

  // 内容
  String? content;

  // 发布时间
  String? releasedTime;

  // 作者来源
  String? releasedBy;

  // 附件信息
  List<AttachmentInfos>? attachmentInfos;

  // 资源大小
  int? attachmentSize;

  // 附件下载次数
  int? downloadTime;

  // 查看次数
  int? watchTime;

  // 点赞次数
  int? likeTime;

  // 创建人
  String? createdName;

  // 是否点赞
  bool? like;

  // 首页资讯置顶
  bool? recommend;

  // 免费旗帜
  bool? freeFlag;

  // 栏目id
  String? columnId;

  ResourceModel({
    this.createdTime,
    this.modifyTime,
    this.createdBy,
    this.modifyBy,
    this.id,
    this.examId,
    this.examName,
    this.industryId,
    this.industryName,
    this.categoryId,
    this.categoryName,
    this.title,
    this.alias,
    this.sort,
    this.top,
    this.hot,
    this.type,
    this.cover,
    this.summary,
    this.content,
    this.releasedTime,
    this.releasedBy,
    this.attachmentInfos,
    this.attachmentSize,
    this.downloadTime,
    this.watchTime,
    this.likeTime,
    this.createdName,
    this.like,
    this.recommend,
    this.freeFlag,
    this.columnId,
  });

  ResourceModel.fromJson(Map<String, dynamic> json) {
    createdTime = json['createdTime'];
    modifyTime = json['modifyTime'];
    createdBy = json['createdBy'];
    modifyBy = json['modifyBy'];
    id = json['id'];
    examId = json['examId'];
    examName = json['examName'];
    industryId = json['industryId'];
    industryName = json['industryName'];
    categoryId = json['categoryId'];
    categoryName = json['categoryName'];
    title = json['title'];
    alias = json['alias'];
    sort = json['sort'];
    top = json['top'];
    hot = json['hot'];
    type = json['type'];
    cover = json['cover'];
    summary = json['summary'];
    content = json['content'];
    releasedTime = json['releasedTime'];
    releasedBy = json['releasedBy'];
    if (json['attachmentInfos'] != null) {
      attachmentInfos = <AttachmentInfos>[];
      json['attachmentInfos'].forEach((v) {
        attachmentInfos!.add(AttachmentInfos.fromJson(v));
      });
    }
    attachmentSize = json['attachmentSize'];
    downloadTime = json['downloadTime'];
    watchTime = json['watchTime'];
    likeTime = json['likeTime'];
    createdName = json['createdName'];
    like = json['like'];
    recommend = json['recommend'];
    freeFlag = json['freeFlag'];
    columnId = json['columnId'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['createdTime'] = createdTime;
    data['modifyTime'] = modifyTime;
    data['createdBy'] = createdBy;
    data['modifyBy'] = modifyBy;
    data['id'] = id;
    data['examId'] = examId;
    data['examName'] = examName;
    data['industryId'] = industryId;
    data['industryName'] = industryName;
    data['categoryId'] = categoryId;
    data['categoryName'] = categoryName;
    data['title'] = title;
    data['alias'] = alias;
    data['sort'] = sort;
    data['top'] = top;
    data['hot'] = hot;
    data['type'] = type;
    data['cover'] = cover;
    data['summary'] = summary;
    data['content'] = content;
    data['releasedTime'] = releasedTime;
    data['releasedBy'] = releasedBy;
    if (attachmentInfos != null) {
      data['attachmentInfos'] =
          attachmentInfos!.map((v) => v.toJson()).toList();
    }
    data['attachmentSize'] = attachmentSize;
    data['downloadTime'] = downloadTime;
    data['watchTime'] = watchTime;
    data['likeTime'] = likeTime;
    data['createdName'] = createdName;
    data['like'] = like;
    data['recommend'] = recommend;
    data['freeFlag'] = freeFlag;
    data['columnId'] = columnId;
    return data;
  }
}

class AttachmentInfos {
  // 资料名
  String? name;

  // 阿里云地址
  String? path;

  // 大小
  int? size;

  AttachmentInfos({this.name, this.path, this.size});

  AttachmentInfos.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    path = json['path'];
    size = json['size'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['name'] = name;
    data['path'] = path;
    data['size'] = size;
    return data;
  }
}
